package com.origin.niuke.math;

/**
 * @author yzh
 * @version 1.0
 * @date 2022/7/4 22:50
 * 回文数字
 * 算法：数学
 */
public class NC56 {

    public boolean isPalindrome (int x) {
        if (x < 0) return false;
        int div = 1;
        while (x / div >= 10) div *= 10;
        while (x > 0) {
            int l = x / div, y = x % 10;
            if (l != y) return false;
            x = (x % div) / 10;
            div /= 100;
        }
        return true;
    }

}
